<template>
     <!-- 底部部分 -->
    <footer class="footer">
      <span class="todo-count"><strong>{{shengyu}}</strong>剩余</span>
      <ul class="filters" @click="$emit('qiehuan',type)">
        <li>
          <a
          @click.prevent="type='all'"
         :class="{selected:type==='all'}" 
          href="#/">全部</a>
        </li>
        <li>
          <a 
          @click.prevent="type='active'"
          :class="{selected:type==='active'}"
          href="#/active">进行中</a>
        </li>
        <li>
          <a 
          @click.prevent="type='completed'"
          :class="{selected:type==='completed'}"
          href="#/completed">已完成</a>
        </li>
      </ul>
      <button class="clear-completed" v-show="showChange" @click="fn">清除已完成</button>
    </footer>
</template>

<script>
export default {
  name: 'VueTodolistTodoFooter',
  props:{
    list:{
      type:Array,
      required:true
    }
  },
  data() {
    return {
      type:''
    };
  },
   computed:{
    shengyu(){
      return this.list.length
    },
    showChange(){
      return this.list.some(item =>item.isDone )
    },
  },
  methods:{
    fn(){
      this.$emit('hShow')
    }
  }
};
</script>

<style lang="scss" scoped>

</style>